package com.capgemini.crm.service;

import java.util.ArrayList;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.capgemini.core.PageList;
import com.capgemini.crm.mapper.RoadsideServiceMapper;
import com.capgemini.crm.pojo.RoadsideServicePOJO;

/**
 * 
 * @author
 * @date
 */
@Service
@Transactional
public class RoadsideService {
	public final Logger log = LoggerFactory.getLogger(this.getClass());

	@Autowired
	private RoadsideServiceMapper roadsideServiceMapper;

	public void queryPage(PageList<RoadsideServicePOJO> rss) {
		RoadsideServicePOJO rs = (RoadsideServicePOJO) rss.getParam();
		if((null == rs.getMobilePhone() || "".equals(rs.getMobilePhone())) &&
				(null == rs.getLicensePlate() || "".equals(rs.getLicensePlate())) &&
				(null == rs.getCardNum() || "".equals(rs.getCardNum()))) {
			return;
		}
		List<RoadsideServicePOJO> rsl = roadsideServiceMapper.queryRSSPage(rss);
		if(null != rsl) {
			rss.setItems(rsl);
		} else {
			rss.setItems(new ArrayList<RoadsideServicePOJO>(0));
		}
	}
}
